import { lazy } from "react";
import {createBrowserRouter} from 'react-router-dom'
import { Navigate } from "react-router-dom";
import Zhu from '../page/Zhu/Index'
import Login from '../page/Login/Index'
import Error from '../page/404/Index'
import Home from '../page/Home/Index'
import List from '../page/List/Index'
import Order from '../page/Order/Index'
import My from '../page/My/Index'

export const menu_router=[
    {
        path:"/zhu/home",
        element:<Home></Home>,
        title:"首页",
    },
    {
         path:"/zhu/list",
        element:<List></List>,
        title:"列表",
        children:[
            {
                path:"/zhu/list/order",
                element:<Order></Order>,
                title:"查询列表"
            }
        ]
    },
    {
        path:"/zhu/my",
        element:<My></My>,
        title:"表单页"
    }
]

const routes=createBrowserRouter([
    {
        path:"/",
        element:<Navigate to={'zhu'}></Navigate>
    },
    {
        path:"/zhu",
        element:<Zhu></Zhu>,
        children:menu_router,
    },
    {
        path:"/login",
        element:<Login></Login>
    },
    {
        path:"*",
        element:<Error></Error>
    }
])

export default routes